import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s1 = in.next();
        String s2 = in.next();
        System.out.println(CheckPermutation(s1,s2));
    }
    public static boolean CheckPermutation(String s1, String s2) {
        if(s1.length()!=s2.length()){
            return false;
        }
        //创建一个数组
        int[] arr = new int[26];
        char[] str1 = s1.toCharArray();
        char[] str2 = s2.toCharArray();
        int index;
        //先将str1放入数组
        for (int i = 0; i < str1.length; i++) {
            index= (int) str1[i]-97;
            arr[index]++;
        }
        for (int i = 0; i < str2.length; i++) {
            index = (int) str2[i]-97;
            arr[index]--;
            if(arr[index]<0){
                return false;
            }
        }
        return true;
    }
}
